package org.istt.domain;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;
import org.joda.time.DateTime;


/**
 * Exchange entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="TBL_EXCHANGE"
    ,schema="dbo"
    ,catalog="onegate"
)

public class Exchange extends BaseObject<Long> implements java.io.Serializable {


    // Fields    

     /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String comment;
    private DateTime date;
    private File file;
    private Long id;
    private User sender;
    private Boolean status;
    private User user;
     


    // Constructors

    /** default constructor */
    public Exchange() {
    }

    
    /** full constructor */
    public Exchange(Long id, DateTime date, String comment, User user, File file) {
        this.id = id;
        this.date=date;
        this.user= user;
        this.file=file;

    }

   
    @Override
	public boolean equals(Object o) {
		
		return false;
	}
    
    @Column(name = "COMMENT", length = 1000)
	public String getComment() {
		return this.comment;
	}

    @Column(name = "DATE")
    @Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
	public DateTime getDate() {
		return this.date;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FILE_ID")
	public File getFile() {
		return this.file;
	}

    
	// Property accessors
    @Id @GeneratedValue(strategy=IDENTITY)
    @Column(name="ID", unique=true, nullable=false)
    public Long getId() {
        return this.id;
    }

	@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="SENDER_ID")
	public User getSender() {
		return sender;
	}

	@Column(name = "STATUS")
	public Boolean getStatus() {
		return status;
	}
	@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="USER_ID")
	public User getUser() {
		return this.user;
	}


	@Override
	public int hashCode() {
		
		return 0;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}


	public void setDate(DateTime date) {
		this.date = date;
	}
	
	public void setFile(File file) {
		this.file = file;
	}

	public void setId(Long id) {
        this.id = id;
    }


	public void setSender(User sender) {
		this.sender = sender;
	}


	public void setStatus(Boolean status) {
		this.status = status;
	}


	public void setUser(User user) {
		this.user = user;
	}


	@Override
	public String toString() {
		
		return null;
	}

}